package com.wsd.web;

import com.cif.common.Result;
import com.cif.service.CustomerService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author wangyuyang
 * @create 2020/7/28 11:00
 */
@Controller
public class CustomerController {

    @Reference(version = "1.0.0", url = "${dubbo.service.cifurl}")
    private CustomerService customerService;

    /**
     * 通过用户编号获取用户信息
     *
     * @param userId
     * @return
     */
    @RequestMapping("/customer")
    @ResponseBody
    public Result selectCustomer(@RequestParam("userId") String userId) {
        Result result = customerService.getCustomerById(userId);
        return result;
    }

    /**
     * 用户修改个人信息
     *
     * @param customerInfo
     * @return
     */
    @RequestMapping("updateCustomerInfo")
    @ResponseBody
    public Result updateCoutomer(@RequestParam("customerInfo") String customerInfo) {
        Result result = customerService.updateCustomer(customerInfo);
        return result;
    }
}

